<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%--
  Created by IntelliJ IDEA.
  User: Wangzs
  Date: 2018/7/6
  Time: 7:43
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!-- Content Header (Page header) -->
<section class="content-header" style="">
    <h1>
        ${archives.comName}
        <small>详情信息</small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 主页</a></li>
        <li><a href="#">详情信息</a></li>
        <li class="active">${archives.comName}</li>
    </ol>
</section>

<!-- Main content -->
<section class="content">
    <ul class="nav nav-tabs">
        <shiro:hasRole name="风控负责人">
            <li><a href="#" onclick="loadHref('#riskCheck')">风控审核</a></li>
            <li class="active"><a href="#">资料审核</a></li>
        </shiro:hasRole>
    </ul>
    <div class="box">
        <div class="box-body">
            <div class="col-xs-12 col-sm-12">
                <div class="panel panel-default">
                    <div class="panel-heading">企业详情信息</div>
                    <div class="panel-body">
                        <div class="col-md-5">
                            <ul>
                                <li>业务类别：${archives.businessTypeSTR}</li>
                                <li>状态：${archives.statusSTR}</li>
                                <li>企业类型：${archives.comTypeSTR}</li>
                            </ul>
                        </div>
                        <div class="col-md-6">
                            <li>企业名称：${archives.comName}</li>
                            <li>营业执照编号：${archives.businessCode}</li>
                            <li>授信额度：${archives.creditLine}</li>
                            <li>授信期限(年)：${archives.creditLimit}</li>
                            <li>录入时间：${archives.inputTimeSTR}</li>
                        </div>
                        <div class="box-header with-border">
                        </div>
                        <c:forEach items="${archives.tbCompayUploadInfos}" var="tbCompayUploadInfo">
                            <c:if test="${tbCompayUploadInfo.isDisplay==1}">
                            <div class="col-sm-2" id="imageList1">
                                <c:choose>
                                    <c:when test="${fn:containsIgnoreCase(tbCompayUploadInfo.picUrl, '.png')||fn:containsIgnoreCase(tbCompayUploadInfo.picUrl, '.jpg')||fn:containsIgnoreCase(tbCompayUploadInfo.picUrl, '.jpeg')||fn:containsIgnoreCase(tbCompayUploadInfo.picUrl, '.gif')||fn:containsIgnoreCase(tbCompayUploadInfo.picUrl, '.bmp')}">
                                        <div class="images" style="width:114px; height:210px;">
                                            <img src=${tbCompayUploadInfo.picUrl} style="width: 110px; height: 110px;">
                                            <br>
                                            <label>${tbCompayUploadInfo.picName}</label><br>
                                            <a href="#" onclick='showhtfun("${tbCompayUploadInfo.picUrl}")'>下载</a>
                                        </div>
                                    </c:when>
                                    <c:when test="${empty tbCompayUploadInfo.picUrl}">
                                        <div class="images" style="width:114px; height:210px;">
                                            <br>
                                            <label>${tbCompayUploadInfo.picName}</label><br>
                                        </div>
                                    </c:when>
                                    <c:otherwise>
                                        <div class="images" style="width:114px; height:210px;">
                                            <a target="_blank" href=${tbCompayUploadInfo.picUrl}>下载</a>
                                            <br>
                                            <label>${tbCompayUploadInfo.picName}</label><br>
                                        </div>
                                    </c:otherwise>
                                </c:choose>

                            </div>
                            </c:if>
                        </c:forEach>
                    </div>
                </div>
            </div>
            <div class="col-xs-12 col-sm-12">
                <%--担保方--%>
                <c:forEach items="${archivesGuarantees}" var="guarantees">
                <div class="panel panel-default">
                    <div class="panel-heading">担保企业</div>
                    <div class="panel-body">
                        <div class="col-md-12">
                            <ul>
                                <li>类别：${guarantees.comTypeSTR}</li>
                                <li>录入时间：${guarantees.inputTimeSTR}</li>
                                <li>担保人名称：${guarantees.comName}</li>
                                <li>担保余额：${guarantees.creditLine}</li>
                            </ul>
                        </div>

                        <c:forEach items="${guarantees.tbCompayUploadInfos}" var="uploadInfo">
                            <c:if test="${uploadInfo.isDisplay==1}">
                                <div class="col-sm-2" id="imageList1">
                                    <c:choose>
                                        <c:when test="${fn:containsIgnoreCase(uploadInfo.picUrl, '.png')||fn:containsIgnoreCase(uploadInfo.picUrl, '.jpg')||fn:containsIgnoreCase(uploadInfo.picUrl, '.jpeg')||fn:containsIgnoreCase(uploadInfo.picUrl, '.gif')||fn:containsIgnoreCase(uploadInfo.picUrl, '.bmp')}">
                                            <div class="images" style="width:114px; height:210px;">
                                                <img src=${uploadInfo.picUrl} style="width: 110px; height: 110px;"></img>
                                                <br>
                                                <label>${uploadInfo.picName}</label><br>
                                                <a href="#" onclick='showhtfun("${uploadInfo.picUrl}")'>下载</a>
                                            </div>
                                        </c:when>
                                        <c:when test="${empty uploadInfo.picUrl}">
                                            <div class="images" style="width:114px; height:210px;">
                                                <br>
                                                <label>${uploadInfo.picName}</label><br>
                                            </div>
                                        </c:when>
                                        <c:otherwise>
                                            <div class="images" style="width:114px; height:210px;">
                                                <a target="_blank" href=${uploadInfo.picUrl}>下载</a>
                                                <br>
                                                <label>${uploadInfo.picName}</label><br>
                                            </div>
                                        </c:otherwise>
                                    </c:choose>

                                </div>
                            </c:if>
                        </c:forEach>
                    </div>
                </div>
            </div>
            </c:forEach>
        </div>
    </div>
    <!-- /.box -->
</section>
<!-- /.content -->

<div id="img-modal" class="modal fade">
    <div id="img-dialog" class="modal-dialog" style="width: 98%; height: 98%;text-align: center;">
        <div id="img-content" class="modal-content">
            <img id="img-zoom" src="" style="max-height: 100%; max-width: 100%;margin:10px;">
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->

<script>
    $(function () {

        //点击图片放大
        $("#img-zoom").click(function () {
            $('#img-modal').modal("hide");
        });
        $("#img-dialog").click(function () {
            $('#img-modal').modal("hide");
        });
        //index-list-content为显示文章内容div的class
        $(".images img").each(function (i) {
            var src = $(this).attr("src");
            $(this).click(function () {
                $("#img-zoom").attr("src", src);
                var oImg = $(this);
                var img = new Image();
                img.src = $(oImg).attr("src");
                var realWidth = img.width;//真实的宽度
                var realHeight = img.height;//真实的高度
                var ww = $(window).width();//当前浏览器可视宽度
                var hh = $(window).height();//当前浏览器可视宽度
                $("#img-content").css({"top": 0, "left": 0, "height": "auto"});
                $("#img-zoom").css({"height": "auto"});
                if ((realWidth + 20) > ww) {
                    $("#img-content").css({"width": "100%"});
                    $("#img-zoom").css({"width": "99%"});
                } else {
                    $("#img-content").css({"width": realWidth + 20, "height": realHeight + 20});
                    $("#img-zoom").css({"width": realWidth, "height": realHeight});
                }
                if ((hh - realHeight - 40) > 0) {
                    $("#img-content").css({"top": (hh - realHeight - 40) / 2});
                }
                if ((ww - realWidth - 20) > 0) {
                    $("#img-content").css({"left": (ww - realWidth - 20) / 2});
                }
                $('#img-modal').modal();
            });
        });
    });
    function showhtfun(hturl) {
        window.open("/" + hturl);
    }
</script>